# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')

class JT_0fb1:
    
    Data_array1 = [["上报事件标志","8"],["报警标志","8"],["状态","8"],["纬度","8"],["精度","8"],["高程","4"],["速度","4"],["方向","4"],["时间","12"],["上报事件预留字段1","8"],["上报事件预留字段2","8"],["上报事件数据项列表","0"]]
    protocolStr = ''
    data_g_str1 = '' #数据组1
    result = []

    def LogicAisle(self, protocol, header):
        self.result = header
        self.protocolStr = protocol
        self.data_g_str1 = self.protocolStr[0:]
        flag1 = self.Data_array1
        startPoint1=0
        for i in range(len(flag1)):
            dataarrayLen = flag1[i][1]
            print type(startPoint1)
            print type(int(dataarrayLen))
            if (flag1[i][0] == "上报事件数据项列表"):
                endPoint = -4
            else:
                endPoint = startPoint1+int(dataarrayLen)
            tmpdata = self.data_g_str1[startPoint1:endPoint]
            print type(flag1[i][0])
            print "flag1[i][0]",(flag1[i][0])
            self.result.append(flag1[i][0] + ':' + tmpdata + '\n')
            startPoint1 = endPoint
